package com.wf.ew.system.service;

import com.wf.ew.common.JsonResult;
import com.wf.ew.common.PageParam;
import com.wf.ew.common.PageResult;
import com.wf.ew.system.model.LoginRecord;
import com.wf.ew.system.model.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wf.ew.system.model.UserRole;
import org.apache.poi.ss.formula.functions.T;

import java.util.List;

/**
 * 用户表 服务类
 *
 * @author wangfan
 * @since 2019-02-11
 */
public interface UserService extends IService<User> {

    User getByUsername(String username);

    PageResult<User> listUser(PageParam pageParam);
    public boolean addUser(User user, List<Integer> roleIds,User loginUser);
    boolean updateUser(User user, List<Integer> roleIds);

    /**
     * 保存实体类
     * @param loginRecord
     * @return
     */
    public JsonResult addLoginRecord(LoginRecord loginRecord);


    /**
     * 获取表格
     * @param page
     * @param user
     * @return
     */
    public String list(PageResult<T> page, User user, User loginUser);
    /**
     * 获取表格
     * @param user
     * @return
     */
    public JsonResult userNameUnique(User user);

    /**
     * 获取list
     * @param user
     * @return
     */
    public List<User> list(User user, User loginUser);

    /**
     * 获取list
     * @param user
     * @return
     */
    public List<UserRole> listUserRole(User user);
    /**
     * 根据Id查询
     * @param user
     * @return
     */
    public User getById(User user);

    /**
     * 保存
     * @param user
     * @param loginUser
     * @return
     */
    public JsonResult add(User user,List<Integer> RoleIds, User loginUser);

    /**
     * 修改
     * @param user
     * @param loginUser
     * @return
     */
    public JsonResult update(User user, User loginUser);

    /**
     * 删除
     * @param user
     * @param loginUser
     * @return
     */
    public JsonResult delete(User user, User loginUser);


    /**
     * 修改
     * @param user
     * @param loginUser
     * @return
     */
    public JsonResult udpatePsw(User user, User loginUser, boolean deft);
    public JsonResult udpateState(User user, User loginUser);
    public String loginRecordList(PageResult<T> page, LoginRecord loginRecord);//获取实体类表格
}
